package util;

import org.apache.commons.math3.random.RandomDataGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CrawlSleepTime {
    private static Logger logger = LoggerFactory.getLogger("CrawlSleepTime");

    public static void sleep(int time) {
        try {
            long leftLimit = -500;
            long rightLimit = 1000;
            long generatedLong = new RandomDataGenerator().nextLong(leftLimit, rightLimit);
            Thread.sleep(time*(1000+generatedLong));
        } catch (InterruptedException e) {
            logger.error("Thread interrupted when sleep",e);
        }
    }
}
